const bodyparser = () => {
    return async (ctx, next) => {
        ctx.request.body = await new Promise((resolve, reject) => {
            const arr = []
            ctx.req.on('data', function (chunk) {
                arr.push(chunk)
            })
            ctx.req.on('end', function () {
                // console.log(Buffer.concat(arr).toString())
                // ctx.set('Content-Type', 'text/plain;charset=utf-8')
                resolve(Buffer.concat(arr))
            })
        })
        await next();
    }
}
module.exports = bodyparser;